package jf.collections.range;

import java.util.Iterator;

/**
 * @author ivanalx
 * @date 01.06.2009 14:42:58
 */
public class IntegerRange implements Iterable<Integer> {
	private int from;
	private int to;
	private int step;

	public IntegerRange(int from, int to) {
		this.from = from;
		this.to = to;
		this.step = 1;
	}

	public IntegerRange(int from, int to, int step) {
		this.from = from;
		this.to = to;
		this.step = step;
	}

	@Override
	public Iterator<Integer> iterator() {
		return  new IntegerRangeIterator(from, to , step);
	}


	public static IntegerRange range(int from, int to) {
		return new IntegerRange(from, to);
	}

	public static IntegerRange range(int from, int to, int step) {
		return new IntegerRange(from, to, step);
	}
}
